package
{
	import as3.util.FPSCheck;
	
	import flash.display.Sprite;
	import flash.events.ContextMenuEvent;
	import flash.net.URLRequest;
	import flash.net.navigateToURL;
	import flash.ui.ContextMenu;
	import flash.ui.ContextMenuItem;
	
	import nl.demonsters.debugger.MonsterDebugger;

	public class AndwhyBase extends Sprite
	{
		private var m_debugger:MonsterDebugger;
		private var fpsCheck:FPSCheck = new FPSCheck();
		
		//==========ContextMenu
		private var m_ContextMenu:ContextMenu;
		
		public function AndwhyBase()
		{
			super();
			setDebug();
			setContextMenu();
		}
		
		private function setDebug():void
		{
			m_debugger = new MonsterDebugger(this);
			this.addChild( fpsCheck );
		}
		private function setContextMenu():void
		{
			m_ContextMenu = new ContextMenu();
			m_ContextMenu.hideBuiltInItems();
			var item:ContextMenuItem = new ContextMenuItem("Andwhy");
			item.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, contextMenuSelect_Handler);
			m_ContextMenu.customItems.push(item);
			this.contextMenu = m_ContextMenu;
		}
		private function contextMenuSelect_Handler(e:ContextMenuEvent):void
		{
			var item:ContextMenuItem = e.target as ContextMenuItem;
			MonsterDebugger.trace(this, item.caption + " is Select");
			switch(item.caption)
			{
				case "Andwhy":
				navigateToURL(new URLRequest("http://andwhy.cafe24.com"), "_blank");
				break;
			}
		}
	}
}